<?php

namespace app\admin\controller\auto;

use app\admin\controller\com\Admin;
use app\service\CurdService;
use think\Db;

class Index extends Admin
{
    function form()
    {
        return $this->fetch();
    }

    //数据信息查询
    public function ready()
    {
        $table = input('table', '', 'trim');
        if (empty($table)) {
            data_return('请选择表', -1);
        }
        //查询表是否存在
        $exist = CurdService::check_table_exist($table);
        if (!$exist) {
            data_return('表不存在', -1);
        }
        $info = CurdService::get_table_info($table);
        $data = CurdService::get_table_fields($info);
        data_return('success', 0, $data);
    }
}